package net.sxnic.ugr.dept.action;

import net.sxnic.comm.utils.CommUtils;
import net.sxnic.ugr.UgrConstant;
import net.sxnic.ugr.context.AppContext;
import net.sxnic.ugr.role.Role;
import net.sxnic.comm.*;

/**
 * 
 * Comments: 添加部门action
 * <p>
 * Author：孙宇飞
 * <p>
 * Create Date：2010-6-4
 *  @author 吕盛槐 update date : 2011-9-26
 * <p>
 * 
 * 
 */


@SuppressWarnings("serial")
public class Create extends DeptAction {
	

	public String execute() throws Exception {
		
		 try {						
		    checkRoles(Role.SYSTEM_ADMIN);
			
		 
			deptManager.save(dept);
			
			msg="createSuccess";
			
			//重建deptMap
	        UgrConstant.DEPT_MAP = deptManager.findMap();
			
			// log
			addLog("===用户===" + AppContext.getUserName(request)
					+ "===添加部门信息成功！===id===" + dept.getId());
				
			} catch (Exception e) {
				e.printStackTrace();
			}

		
		

		return SUCCESS;
	}

}
